package com.ruoyi.citylife.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.ruoyi.citylife.mapper.CUserMapper;
import com.ruoyi.citylife.domain.CUser;
import com.ruoyi.citylife.service.ICUserService;

import java.util.List;
import java.util.Map;

/**
 * 微信用户信息Service业务层处理
 *
 * @author ruoyi
 * @date 2021-02-22
 */
@Service
public class CUserServiceImpl extends ServiceImpl<CUserMapper, CUser> implements ICUserService {

    @Override
    public List<CUser> queryList(CUser cUser) {
        LambdaQueryWrapper<CUser> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(cUser.getOpenid())){
            lqw.eq(CUser::getOpenid ,cUser.getOpenid());
        }
        if (StringUtils.isNotBlank(cUser.getNickName())){
            lqw.like(CUser::getNickName ,cUser.getNickName());
        }
        if (StringUtils.isNotBlank(cUser.getAvatar())){
            lqw.eq(CUser::getAvatar ,cUser.getAvatar());
        }
        if (StringUtils.isNotBlank(cUser.getSign())){
            lqw.eq(CUser::getSign ,cUser.getSign());
        }
        if (StringUtils.isNotBlank(cUser.getSex())){
            lqw.eq(CUser::getSex ,cUser.getSex());
        }
        if (StringUtils.isNotBlank(cUser.getStatus())){
            lqw.eq(CUser::getStatus ,cUser.getStatus());
        }
        return this.list(lqw);
    }
}
